package com.chen.serlvet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 向域中删除数据
 */
@WebServlet("/servletC")
public class ServletC extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        // 向请求域中删除数据
        req.removeAttribute("req");
        // 向会话域中删除数据
        req.getSession().removeAttribute("session");
        // 向应用的中删除数据
        getServletContext().removeAttribute("application");
    }
}
